#pragma once
#include "Object.h"

class Context;
class File;
class Resource : public Object
{
public:
	explicit Resource(Context* context);
	virtual ~Resource();

	bool Load(File& file);
	virtual bool BeginLoad(File& file);
	virtual bool EndLoad();
	virtual void Release() {};

	void SetName(const std::string& name);
	void SetMemoryUse(unsigned size);

	const std::string& GetName() const { return name_; }
	unsigned GetNameHash() const { return nameHash_; }
	unsigned GetMemoryUse() const { return memoryUse_; }

	static unsigned Calculate(const char* str);
protected:
	std::string name_;
	unsigned nameHash_{};
	unsigned memoryUse_{};
};